<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}">
</head>
<body class="container">
<br/>

<h1>用户列表</h1>

<br/><br/>

<div class="width:80%">
    <table class="table table-hover">
        <thead>

            <tr>
                <th>#</th>
                <th>用户名</th>
                <th>用户密码</th>
                <th>年龄</th>
                <th>编辑</th>
                <th>删除</th>
            </tr>

        </thead>

        <tbody>

        <tr th:each="user : ${users}">
            <th scope="row" th:text="${user.id}">1</th>
            <td  th:text="${user.username}">方妍</td>
            <td  th:text="${user.password}">123456</td>
            <td th:text="${user.age}">21</td>
            <td ><a th:href="@{/toEdit(id=${user.id})}">编辑</a></td><!--获取当前user的id，传参数要用key,value的方式传参-->
            <td ><a th:href="@{/delete(id=${user.id})}">删除</a></td>
        </tr>

        </tbody>
        
    </table>
</div>

<div class="form-group">
    <div class="col-sm-2 control-label">
        <a href="/toAdd" th:href="@{/toAdd}" class="btn btn-default">添加</a>
    </div>
</div>

</body>
</html>